/*River Warren
 *October 7, 2011
 *
 *Updated Oct 16 2011 8:46PM - River Warren, made changes to reflect updates in base class
 *Updated Oct 16 2011 9:08PM - River Warren, added inventory get methods
 *
 *Room.h
 *Room object to be used by the game Dungeons and Princesses
 *Room has a door object as well various other possible objects
 *including but not limited to: Keys, treasure, monsters, weapons, other equipment and princesses.
 *room has a description which includes
 descriptions of the view in four directions
 description of any doors
 description of any objects in the room
 *Room allows movement from one room to another in accordence with house plot in docs.
 *Room for new game is R0
 */

#ifndef ROOM_H_INCLUDED
#define ROOM_H_INCLUDED

#include "Door.h"
#include "Direction.h"
#include "Inventory.h"
#include <fstream>
#include <ostream>
#include <istream>
#include <string.h>

#define DELIMS ",\n"
#define MAX 250

#include <iostream>
#include "Base.h"

using std::string;
using std::ofstream;
using std::endl;
using std::ifstream;

class Room: public Base, public Inventory
{

private:
    string linkID;//a unique linkID value
    string objectID; // override base class object ID to be a string in room class
    string linkArray[4];//an array to hold the links
    string NorthLink;//either null or file to north of this
    string EastLink;//either null or file to east of this
    string SouthLink;//either null or file to south of this
    string WestLink;//either null or file to west of this
    string descArray[5];//and array to hold the descriptions
    //string description;//general description of room  // this is not needed we are inhearting from base!
    string N_desc;//description of what is to the north
    string E_desc;//description of what is to the east
    string S_desc;//description of what is to the south
    string W_desc;//description of what is to the west
    int has_door;//0 if there is no door, 1 if door is to north, 2 if east, ect.
    Door d;//door object.

    Direction directions[4]; // contains the 4 direction objects of this room

public:
    Room();
    ~Room();


    // ** this code will be discontinued, only left while in transition
    //mgetLink to next room
    //must be contained within try catch block
    string getLink(int);
    string getLinkID(){return linkID;}
    void loadRoom(string);//loads new room
    void saveRoom();//writes new room state to file
    bool hasDoor(){return has_door;}

    //base over ride ******************************
    string getDesc();//get description of room

    //door method***************************
    string getKeyCode();//returns key code for opening door
    bool unlockDoor(string);//unlock door with proper key Id else throws exception

    bool addDirection(Direction newDirectionObject);
    Direction * getDirections();

    Direction getDirection(std::string directionToGet);

    const string getObjectID();
    // Add functions to make class searchable
    
    friend bool operator< (const Room &obj1, const Room &obj2);
    friend bool operator== (const Room &obj1, const string &objectID);
    friend bool operator== (const Room &obj1, const Room &obj2);
    
    friend ostream &operator << (ostream &, const Room &);
protected:

    

};

#endif // ROOM_H_INCLUDED
